<?php
require_once('LeaveFormView.php');

//Add
	if (LeaveFormView :: requestAddLeave("01/15/2010", "01/16/2010", "SICK_LEAVE", 
			"01/20/2010", "3", "01/22/2010", "WITH_PAY") == false) {
		echo "ERROR in requestAddLeave<br />";
	} else {
		echo "CORRECT requestAddLeave<br />";
	}
	
	
	if (LeaveFormController :: addLeaveForm("01/15/2010", "01/16/2010",
			"SICK_LEAVE","01/20/2010","3","01/22/2010","WITH_PAY")==false) {
		echo "ERROR in addLeaveForm<br />";
	} else {
		echo "CORRECT addLeaveForm<br />";
	}
	
	if (LeaveManager::insertLeaveForm("01/15/2010", "01/16/2010", "SICK_LEAVE",
			"3", "01/20/2010", "01/22/2010", "WITH_PAY") == false) {
		echo "ERROR in insertLeaveForm<br />";
	} else {
		echo "CORRECT insertLeaveForm<br />";
	}
		
	if (LeaveFormView :: showMessage(3)==3) {
		echo "ERROR in showMessage<br />";
	} else {
		echo "CORRECT showMessage<br />";
	}
	
//Load
	if (LeaveFormView :: requestLeaveList()==0) {
		echo "ERROR in requestLeaveList<br />";
	} else {
		echo "CORRECT requestLeaveList<br />";
	}
	
	if (LeaveFormController :: generateLeaveList()==0) {
		echo "ERROR in generateLeaveList<br />";
	} else {
		echo "CORRECT generateLeaveList<br />";
	}
	
	if (LeaveManager :: getLeaveData() == NULL) {
		echo "ERROR in getLeaveData<br />";
	} else {
		echo "CORRECT getLeaveData<br />";
	}
	
	$link = makeSQLconnection();
	$q1 = sprintf("SELECT * FROM `LEAVEFORM`");
	$r1 = mysql_query($q1, $link);
		
	if (LeaveFormView :: showLeaveList($r1)==0) {
		echo "ERROR in showLeaveList<br />";
	} else {
		echo "CORRECT showLeaveList<br />";
	}
	mysql_close($link);

//Edit
	if (LeaveFormView :: requestEditLeave()==0) {
		echo "ERROR in requestEditLeave<br />";
	} else {
		echo "CORRECT requestEditLeave<br />";
	}

	if (LeaveFormController :: editLeaveForm("1","01/15/2010", "01/16/2010",
			"SICK_LEAVE", "01/20/2010", "3", "01/22/2010", "WITH_PAY")==0) {
		echo "ERROR in editLeaveForm<br />";
	} else {
		echo "CORRECT editLeaveForm<br />";
	}
	
	
	if (LeaveManager :: updateLeaveForm("1", "01/15/2010", "01/16/2010", "SICK_LEAVE", "01/20/2010", "3", "01/22/2010", "WITH_PAY") == 0) {
		echo "ERROR in updateLeaveForm<br />";
	} else {
		echo "CORRECT updateLeaveForm<br />";
	}
	
?>